home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
THINKC
/
4_0
/
CMD-.
< prev
next >
Wrap
Text File
|
1990-05-05
|
2KB
|
42 lines
/* This is a simple extension to CSwitchboard to detect cmd-period
)5/4/1990 version 1.0
by j "Knife-the-Mac" geagan, AKA Pad-Parrot Productions CIS:71311,301
no rights reserved; free; etc., etc.
Hey Symantec: Please (feel free to) include this in THINK C 5.0
% It patches the Switchboard to send a "cmdPeriod" message to gGopher
if there is no active menu item for command-period
% To use, just add this file to your project and remove <CApplication.C>
% No need to worry about "#include <CApplication.h>" - no changes there
% You also need to create a <Ccommands.h> file that #defines cmdPeriod
as your desired command-number
*/
#include <Ccommands.h> /* YOU must create this file! */
#include <CSwitchboard.h>
#include <CBureaucrat.h>
#include <CBartender.h>
#include <Global.h>
extern CBureaucrat *gGopher;
extern CBartender *gBartender;
struct jSwitchboard:CSwitchboard {
void DoKeyEvent(EventRecord*);
};
void jSwitchboard::DoKeyEvent(register EventRecord *macEvent) {
register char theChar=macEvent->message & charCodeMask;
if (theChar=='.' && (macEvent->what==keyDown && (macEvent->modifiers & cmdKey))) {
gBartender->UpdateAllMenus(); /* it's a command-period; look in menus */
if (!HiShort(MenuKey(theChar))) { /* no menu command for CMD-PERIOD */
gGopher->DoCommand(cmdPeriod);
return;
}
/* else it will hilite the menu again (in inherited), but so what? */
}
inherited::DoKeyEvent(macEvent);
}
/* override any CSwitchboard uses in CApplication to jSwitchboard */
#define CSwitchboard jSwitchboard
#include <CApplication.